package cn.shadow.module.chess.message.chnChess.frame;

import java.util.HashMap;
import java.util.Map;

public enum State {
    NORMAL("正常", 1), CHOSEN("选中", 2), CHECK("将军", 3);
   private String name;
   private int value;

    State(String name, int value) {
        this.name = name;
        this.value = value;
    }
    private final static Map<Integer, State> stateMap = new HashMap<>();

    static {
        State[] values = State.values();
        for (State value : values) {
            stateMap.put(value.value, value);
        }
    }

    public static State state(int value) {
        return stateMap.get(value);
    }

    public String getName() {
        return name;
    }

    public int getValue() {
        return value;
    }

    @Override
    public String toString() {
        return "[" + "name='" + name + '\'' +
                ", value=" + value +
                ']';
    }
}
